home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / share / ewl / examples / ewl_icon_test.c < prev    next >
C/C++ Source or Header  |  2006-01-09  |  2KB  |  69 lines

  1. #include "ewl_test.h"
  2.  
  3. static Ewl_Widget *icon_button;
  4.  
  5. static void
  6. cb_destroy_win(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__)
  7. {
  8.     ewl_widget_destroy(w);
  9.     ewl_callback_append(icon_button, EWL_CALLBACK_CLICKED,
  10.                 __create_icon_test_window, NULL);
  11. }
  12.  
  13. void
  14. __create_icon_test_window(Ewl_Widget *w, void *ev __UNUSED__, 
  15.                     void *data __UNUSED__)
  16. {
  17.     Ewl_Widget *win, *box, *o, *o2;
  18.  
  19.     win = ewl_window_new();
  20.     ewl_window_title_set(EWL_WINDOW(win), "Icon Test");
  21.     ewl_window_name_set(EWL_WINDOW(win), "EWL Test Application");
  22.     ewl_window_class_set(EWL_WINDOW(win), "EFL Test Application");
  23.  
  24.     if (w) 
  25.     {
  26.         ewl_callback_del(w, EWL_CALLBACK_CLICKED,
  27.                     __create_icon_test_window);
  28.         ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
  29.                         cb_destroy_win, NULL);
  30.     }
  31.     else
  32.         ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
  33.                         __close_main_window, NULL);
  34.  
  35.     ewl_widget_show(win);
  36.  
  37.     box = ewl_vbox_new();
  38.     ewl_container_child_append(EWL_CONTAINER(win), box);
  39.     ewl_widget_show(box);
  40.  
  41.     o = ewl_icon_new();
  42.     ewl_icon_image_set(EWL_ICON(o), 
  43.                 PACKAGE_DATA_DIR "/images/Draw.png", NULL);
  44.     ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)");
  45.     ewl_icon_editable_set(EWL_ICON(o), TRUE);
  46.     ewl_container_child_append(EWL_CONTAINER(box), o);
  47.     ewl_widget_show(o);
  48.  
  49.     o = ewl_hseparator_new();
  50.     ewl_container_child_append(EWL_CONTAINER(box), o);
  51.     ewl_widget_show(o);
  52.  
  53.     o2 = ewl_text_new();
  54.     ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set "
  55.                     "on it.\n\n That data is just \n"
  56.                     "text, but could\nbe any widget.");
  57.     ewl_widget_show(o2);
  58.  
  59.     o = ewl_icon_new();
  60.     ewl_icon_image_set(EWL_ICON(o), 
  61.                 PACKAGE_DATA_DIR "/images/World.png", NULL);
  62.     ewl_icon_extended_data_set(EWL_ICON(o), o2);
  63.     ewl_icon_label_set(EWL_ICON(o), "World");
  64.     ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG);
  65.     ewl_container_child_append(EWL_CONTAINER(box), o);
  66.     ewl_widget_show(o);
  67. }
  68.  
  69.